<%@ page language="java" contentType="text/html; charset=UTF-8" import="com.newcrm.config.*,java.net.URLEncoder,com.newcrm.bean.*" pageEncoding="UTF-8"%>
<%
	String dbIp = "";
  String dbPort = "";
  String dbName = "";
  String dbUser = "";
  String dbPassword = "";
  String companyName = "";
  String userId = "";
  String userName = "";
  String userPassword = "";
  String email = "";
  String checkCode = "";
  String activeCode = "";
  String companyId2 = "";
  String licenceNum = "";
  String expiredDate = "";
  // 获取产品信息
  ProductInfo productInfo = Config.getInstance().productInfo;
  String productName = productInfo.productName;
  String companyHref = productInfo.companyHref;
  
  try {
   if ("1".equals(productInfo.activeCodeFlag)) {
    checkCode = URLEncoder.encode((String)request.getAttribute("checkCode"), "UTF-8");
    activeCode = URLEncoder.encode((String)request.getAttribute("activeCode"), "UTF-8");
    companyId2 = URLEncoder.encode((String)request.getAttribute("companyId2"), "UTF-8");
    licenceNum = URLEncoder.encode((String)request.getAttribute("licenceNum"), "UTF-8");
    expiredDate = URLEncoder.encode((String)request.getAttribute("expiredDate"), "UTF-8");
   }
    dbIp = URLEncoder.encode((String)request.getAttribute("dbIp"), "UTF-8");
    dbPort = URLEncoder.encode((String)request.getAttribute("dbPort"), "UTF-8");
    dbName = URLEncoder.encode((String)request.getAttribute("dbName"), "UTF-8");
    dbUser = URLEncoder.encode((String)request.getAttribute("dbUser"), "UTF-8");
    dbPassword = URLEncoder.encode((String)request.getAttribute("dbPassword"), "UTF-8");
    companyName = URLEncoder.encode((String)request.getAttribute("companyName"), "UTF-8");
    userId = URLEncoder.encode((String)request.getAttribute("userId"), "UTF-8");
    userName = URLEncoder.encode((String)request.getAttribute("userName"), "UTF-8");
    userPassword = URLEncoder.encode((String)request.getAttribute("userPassword"), "UTF-8");
    email = URLEncoder.encode((String)request.getAttribute("email"), "UTF-8");
  } catch (NullPointerException e) {
  }
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title><%=productName%> 安装向导</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="renderer" content="webkit"/>
  <meta http-equiv=X-UA-Compatible content="IE=EmulateIE7" />
  <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/qikebao.ico" />
  <link href="<%=request.getContextPath()%>/css/setup<%=productInfo.logoImageExtInfo%>.css?ver=<%=Const.VERSION%>" media="screen" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-1.11.1.min.js"></script>
  <script>
    function showMsg(_msg) {
      var _div = $("#showMsgDiv");
      _div.append("<p>" + _msg + "</p>");
      document.getElementById('showMsgDiv').scrollTop = document.getElementById('showMsgDiv').scrollHeight;
    }
    function finish() {
      window.location = "<%=request.getContextPath()%>/setup/finish";
    }
  </script>
</head>
<body>
  <div class="container">
    <div class="header">
      <div class="header-title">
        <h1><%=productName%> 安装向导</h1>
        <span>新一代客户管理平台</span>
      </div>
      <div class="setup step3">
        <h2>安装数据库</h2>
        <p>安装<%=productName%>所需要的数据库和数据库表</p>
      </div>
      <div class="stepstat">
        <ul>
          <li class="activated">1</li>
          <li class="activated">2</li>
          <li class="current">3</li>
          <li class="unactivated last">4</li>
          </ul>
        <div class="stepstatbg stepstat3"></div>
      </div>
    </div>
    <div class="main">
      <div><br />
        <div class="desc"><b>正在安装数据库，请稍候...</b></div>
        <div class="frame" id="showMsgDiv"></div>
        <% if ("1".equals(productInfo.activeCodeFlag)) {%>
        <iframe width="0" src="<%=request.getContextPath()%>/setup/database?dbIp=<%=dbIp%>&dbPort=<%=dbPort%>&dbName=<%=dbName%>&dbUser=<%=dbUser%>&dbPassword=<%=dbPassword%>&companyName=<%=companyName%>&userId=<%=userId%>&userName=<%=userName%>&userPassword=<%=userPassword%>&email=<%=email%>&checkCode=<%=checkCode%>&activeCode=<%=activeCode%>&companyId2=<%=companyId2%>&licenceNum=<%=licenceNum%>&expiredDate=<%=expiredDate%>" height="0" frameborder="0"></iframe>
        <% } else {%>
        <iframe width="0" src="<%=request.getContextPath()%>/setup/database?dbIp=<%=dbIp%>&dbPort=<%=dbPort%>&dbName=<%=dbName%>&dbUser=<%=dbUser%>&dbPassword=<%=dbPassword%>&companyName=<%=companyName%>&userId=<%=userId%>&userName=<%=userName%>&userPassword=<%=userPassword%>&email=<%=email%>" height="0" frameborder="0"></iframe>
        <% }%>
      </div>
      <div class="footer">&copy;2010 - 2017 <a href="<%=companyHref%>"><%=productName%></a> Inc.</div>
    </div>
  </div>
</body>
</html>